 <?php
	print("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n");
	print("<bcases>\n");
	if(!isset($_GET["PID"]))
	{
		print("</bcases>\n");
		return;
	}

    $db = mysql_connect("localhost","root","root");
    mysql_select_db("brainway");
    
	$query = "select case_name.CID CID, case_name.name name, case_discription.discription discription 
			  from case_name left join case_discription on case_name.CID = case_discription.CID
			  where case_name.project_id = ".$_GET["PID"];
	
	$result = mysql_query($query);
	$num_rows = mysql_num_rows($result);
	
	for( $row_num=0; $row_num < $num_rows; $row_num++)
	{
        $row = mysql_fetch_array($result);
        print("  <bcase>\n");
        print("    <CID>".$row["CID"]."</CID> \n");
        print("    <name>".$row["name"]."</name> \n");
        print("	   <discription>".$row["discription"]."</discription>\n");
        print("  </bcase>\n");
	}
	print("</bcases>\n");
?>